package com.ostrich.a2104gao5.test12

/**
 * @Author : yaotianxue
 * @Time : On 2023/10/16 14:53
 * @Description : Student
 */
//主构造
class Student(var name:String = "默认值",var age:Int) {
    //次构造必须继承主构造
    constructor(name:String):this(name,18)
    constructor(age:Int):this("无名氏",age)
    //初始化代码块
    init {
        println("初始化代码块，每次创建该类对象之前执行")
    }
}